package org.csmzxy.class2333;

public class Exercise02 {
    public static void main(String[] args) {
        int sumOfPrimes = sumOfPrimesLessThan100();
        System.out.println("100以内的素数之和是：" + sumOfPrimes);
    }
    public static int sumOfPrimesLessThan100() {
        int sum = 0;
        for (int i = 2; i < 100; i++) {
            if (isPrime(i)) {
                sum += i;
            }
        }
        return sum;
    }
    public static boolean isPrime(int num) {
        if (num <= 1) {
            return false;
        }
        for (int i = 2; i <= Math.sqrt(num); i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }
}